﻿using GetSmartIDEList.WebAPI.Common;
using GetSmartIDEList.WebAPI.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Nancy.Json;

namespace GetSmartIDEList.WebAPI.Controllers
{
    /// <summary>
    /// 移动数据到右边的接口：插入右表
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class MoveToController : ControllerBase
    {
        //[HttpPost(template: "{name}")]
        [HttpPost]
        [AcceptVerbs("Post")]
        public IEnumerable<resultData> MoveTo([FromBody] string name)
        {
            if (name is null)
            {
                return new List<resultData>() { };
            }
            else
            {
                //先移动
                ReposFunction.MoveData(name);

                //再重新获取
                var lstData = CurrentListFunction.GetLeftRepos();
                return lstData;
            }
        }
    }
}
